package com.example.shop.user.dto;



public class UserQueryParam {
    public static final String QUERY_SQL=
            " " +
            "<if test = 'ew.userId != null'>" +
                "`user`.user_id = #{ew.userId} and " +
            "</if>" +
            "<if test = 'ew.userName != null'>" +
                "`user`.user_name = #{ew.userName} and " +
            "</if>" +
            "<if test = 'ew.userAccount != null'>" +
                "`user`.user_account = #{ew.userAccount} and " +
            "</if>" +
            "<if test = 'ew.userPhone != null'>" +
                "`user`.user_phone = #{ew.userPhone} and " +
            "</if>" +
            "<if test = 'ew.userEmail != null'>" +
                "`user`.user_email = #{ew.userEmail} and " +
            "</if>" + " 1 ";

    private Long userId;
    private String userName;
    private String userAccount;
    private String userPhone;
    private String userEmail;
    private UserQueryParam(){
    }
    public static Builder builder(){
        return new Builder();
    }
    public static class Builder{
        protected UserQueryParam userQueryParam;
        public Builder(){
            userQueryParam = new UserQueryParam();
        }
        public UserQueryParam build(){
            return userQueryParam;
        }
        public Builder setUserId(Long userId) {
            userQueryParam.userId = userId;
            return this;
        }

        public Builder setUserName(String userName) {
            userQueryParam.userName = userName;
            return this;
        }

        public Builder setUserAccount(String userAccount) {
            userQueryParam.userAccount = userAccount;
            return this;
        }

        public Builder setUserPhone(String userPhone) {
            userQueryParam.userPhone = userPhone;
            return this;
        }

        public Builder setUserEmail(String userEmail) {
            userQueryParam.userEmail = userEmail;
            return this;
        }
    }
}
